package cn.northsea.controller;

import cn.northsea.common.CollaborativeFilteringJobRecommendation;
import cn.northsea.common.Result;
import cn.northsea.entity.Seek;
import cn.northsea.entity.SeekUser;
import cn.northsea.service.SeekService;
import cn.northsea.service.UserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import java.util.*;

import static cn.northsea.common.enums.ResultCodeEnum.REGISTER_SUCCESS;
import static cn.northsea.common.enums.ResultCodeEnum.SUCCESS;

@RequestMapping("/seek")
@CrossOrigin
@RestController
public class SeekController {
    @Autowired
    SeekService seekService;
    @GetMapping("/findAllById")
    public Result findAllById(@RequestParam(required = false,defaultValue = "") String id) {
        Seek seek = seekService.findAllById(id);
        return Result.success(seek);
    }
    @GetMapping("/findUserByUid")
    public Result findUserByUid(@RequestParam(required = false,defaultValue = "") String id) {
        SeekUser seekUser = seekService.findUserByUid(id);
        return Result.success(seekUser);
    }
    @GetMapping("/findAllByUid")
    public Result findAllByUid(@RequestParam(required = false,defaultValue = "") String uid) {
        List<Seek> seek = seekService.findAllByUid(uid);
        return Result.success(seek);
    }
    @PostMapping("/updateById")
    public Result updateById(@RequestBody Seek seek) {
        seekService.updateById(seek);
        return Result.success();
    }
    @GetMapping("/deleteById")
    public Result deleteById(Integer id) {
        seekService.removeById(id);
        return Result.success();
    }
    @PostMapping("/addupdate")
    public Result addupdate(@RequestBody Seek seek) {
        seekService.addupdate(seek);
        return Result.success();
    }
    @GetMapping("/findAll")
    public Result findAll() {
        List<Seek> seek = seekService.findAll1();
        return Result.success(seek);
    }
    @GetMapping("/update")
    public Result update1(Integer id) {
        seekService.update1(id);
        return Result.success(SUCCESS);
    }
}
